package com.fzn.spring5.factorybean;

import com.fzn.spring5.collectiontype.Course;
import org.springframework.beans.factory.FactoryBean;

/**
 * @author fzn
 * @date 2022/2/20
 * @apiNote
 *
 */
public class MyBean implements FactoryBean<Course> {

    /**
     * 定义返回bean 定义的类型可以和返回的类型不一样
     * @return
     * @throws Exception
     */
    @Override
    public Course getObject() throws Exception {
        Course course = new Course();
        course.setName("abc");
        return course;
    }

    @Override
    public Class<?> getObjectType() {
        return null;
    }

    @Override
    public boolean isSingleton() {
        return FactoryBean.super.isSingleton();
    }
}
